<?php
function get_footer()
{
    $GLOBALS['smarty']->assign('google_analytics', stripslashes($GLOBALS['setting']['google_analytics']) );
    $GLOBALS['smarty']->assign('footer_text', $GLOBALS['setting']['footer_text'] );

    return $GLOBALS['smarty']->fetch(IMMOPHP_ROOT_PATH . 'themes'. DS . $GLOBALS['setting']['theme'] . DS .'footer.tpl');
}

function get_currentpage()
{
    $path = $_SERVER['PHP_SELF'];
    $file = basename ($path);
    return $file;
}

function redirect($url, $tps = 0)
{

    $temps = $tps * 1000;
    echo "<script type=\"text/javascript\">\n"
    . "<!--\n"
    . "\n"
    . "function redirect() {\n"
    . "window.location='" . $url . "'\n"
    . "}\n"
    . "setTimeout('redirect()','" . $temps ."');\n"
    . "\n"
    . "// -->\n"
    . "</script>\n";
    exit;
}

function get_ckeditor($name, $contenue, $interface = '', $print = false)
{
    require_once IMMOPHP_ROOT_PATH . 'lib'. DS .'ckeditor'. DS .'ckeditor.php';

    $basePath = $GLOBALS['setting']['url_site'] .'lib/ckeditor/';

    if($interface != '')
    {
        $config['toolbar'] = array(
	array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
	array( 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
	array('TextColor')
	);
    }
    else
       $config = '';


    $CKEditor = new CKEditor();    //Appel de la class
    $CKEditor->returnOutput = true; // empeche l affichage directe
    $CKEditor->basePath = $basePath;
    $CKEditor->config['width'] = 600;  // Definition de la largeur
    $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);
    $code = $CKEditor->editor($name, $contenue, $config);  // Generation du code

    // Affichage de la zone si demander
    if($print == true)
	echo $code;
    else
	return $code;
}
?>